import pymysql

def manipulate(sql,param,host,port,database,user,password,charset):
     con = pymysql.connect(
         host = host,
         port = port,
         database=database,
         user=user,
         password=password,
         charset=charset
     )
     with con.cursor() as cursor:
         cursor.execute(sql,param)
         con.commit()
     con.close()
def select(sql,param,host,port,database,user,password,charset):
     con = pymysql.connect(
         host=host,
         port=port,
         database=database,
         user=user,
         password=password,
         charset=charset
        )
     with con.cursor() as cursor:
        cursor.execute(sql,param)
        data = cursor.fetchall()
        con.commit()
        con.close()
        return data

